import type * as Tables from "./type"
import { request } from "@/http/axios"

const baseURL = import.meta.env.VITE_TRAIN_API

// 获取模型列表
export function getModuleSearch(params: Tables.TableRequestData) {
  return request<Tables.TableResponseData>({
    baseURL,
    url: `/toksim/user_project/search`,
    method: "post",
    params,
    data: params
  })
}

export function editDataApi(params: Tables.ProjectBaseInfo) {
  return request({
    baseURL,
    url: `/toksim/user_project/edit`,
    method: 'post',
    data: params
  })
}

export function saveDataApi(params: Tables.ProjectBaseInfo) {
  return request<ApiResponseData<{ project_id: string }>>({
    baseURL,
    url: `/toksim/user_project/create`,
    method: 'post',
    data: params
  })
}

// 我的项目详情
export function detailDataApi(id: string) {
  return request<Tables.ViewResponseData>({
    baseURL,
    url: `/toksim/user_project/get/${id}`,
    method: 'get'
  })
}

// 删除
export function deleteDataApi(params: string[]) {
  return request({
    baseURL,
    url: `/toksim/user_project/delete`,
    method: 'post',
    data: {
      project_ids: params
    }
  })
}